home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / TOUCHER.PAS < prev    next >
Pascal/Delphi Source File  |  1988-07-01  |  2KB  |  62 lines

  1. {--------------------------------------------------------------}
  2. {                            TOUCHER                           }
  3. {                                                              }
  4. {          'Touch' utility for DOS unit demonstration          }
  5. {                                                              }
  6. {                             by Jeff Duntemann                }
  7. {                             Turbo Pascal V4.0                }
  8. {                             Last update 7/1/88               }
  9. {                                                              }
  10. { From the book, COMPLETE TURBO PASCAL 5.0  by Jeff Duntemann  }
  11. {        Scott, Foresman & Co. 1988  ISBN 0-673-38355-5        }
  12. {--------------------------------------------------------------}
  13.  
  14.  
  15. PROGRAM Toucher;
  16.  
  17. USES DOS;
  18.  
  19. VAR
  20.   I      : Integer;
  21.   Stamp  : LongInt;
  22.   Now    : DateTime;
  23.   Target : File;
  24.   Sec100 : Word;
  25.   DayOfWeek  : Word;
  26.  
  27. BEGIN
  28.   IF ParamCount < 1 THEN
  29.     BEGIN
  30.        Writeln('>>TOUCHER  V1.00 by Jeff Duntemann');
  31.        Writeln('           From the book COMPLETE TURBO PASCAL 5.0');
  32.        Writeln('           Scott, Foresman & Company, 1988');
  33.        Writeln('           ISBN 0-673-38355-5');
  34.        Writeln;
  35.        Writeln('  Calling Syntax:');
  36.        Writeln('  TOUCHER <filename>');
  37.        Writeln;
  38.        Writeln('  TOUCHER is a "touch" utility that replaces ');
  39.        Writeln('  the time/date stamp of a file with the current');
  40.        Writeln('  date and time.  This can be used to force a remake');
  41.        Writeln('  on a project depending on that file.');
  42.     END
  43.   ELSE
  44.     BEGIN
  45.       Assign(Target,ParamStr(1));
  46.       {$I-} Reset(Target); {$I+}
  47.       I := IOResult;
  48.       IF I <> 0 THEN
  49.         BEGIN
  50.           Writeln('>>Error!  Named file cannot be opened...');
  51.         END
  52.       ELSE
  53.         BEGIN
  54.           WITH Now DO GetTime(Hour,Min,Sec,Sec100);
  55.           WITH Now DO GetDate(Year,Month,Day,DayOfWeek);
  56.           PackTime(Now,Stamp);
  57.           SetFTime(Target,Stamp);
  58.           Close(Target);
  59.         END
  60.     END
  61. END.
  62.